package service

import "gitee.com/gopher2011/mall/app/dao"

// 全局公开对象
var SmsHomeRecommendProduct = smsHomeRecommendProductService{}

// 私有对象，所有的方法都绑定到这个结构体上。

type smsHomeRecommendProductService struct{}

func (p *smsHomeRecommendProductService) Create(arg dao.SmsHomeRecommendProductReq) (int64, error) {
	return dao.SmsHomeRecommendProductDao.InsertTemplate(arg.List)
}

func (p *smsHomeRecommendProductService) UpdateSort(id, sort int) (int64, error) {
	return dao.SmsHomeRecommendProductDao.UpdateSort(id, sort)
}

func (p *smsHomeRecommendProductService) Delete(ids []int) (int64, error) {
	return dao.SmsHomeRecommendProductDao.Delete(ids)
}

func (p *smsHomeRecommendProductService) UpdateRecommendStatus(ids []int, recommendStatus int) (int64, error) {
	return dao.SmsHomeRecommendProductDao.UpdateRecommendStatus(ids, recommendStatus)
}

func (p *smsHomeRecommendProductService) List(arg dao.SmsHomeRecommendProductList) ([]dao.SmsHomeRecommendProduct, error) {
	arg.PageNum = (arg.PageNum - 1) * arg.PageSize
	return dao.SmsHomeRecommendProductDao.List(arg)
}
